export default {
    // 添加购物车
    addCart(state, items) {
        state.carts.lists = items;
    },
    calcTotal(state, price) {
        //计算总价格
        state.carts.total = price;
    },
    // 订单相关
    // 提交订单
    addOrder(state, order) {
        state.orders.unshift(order);
    },
    // 设置 订单地址
    setAddress(state, address) {
        state.selectAddress = address;
    },
    //去掉默认地址 
    removeDefault(state){
        let { lists } = state.address;
        lists.map(el=>{
            el.isDefault = false;
        })
        state.address.lists = lists;
    },
    // 修改 地址  地址编辑
    updateAddress(state,ads){
       state.address.lists[ads.index] = ads.ads;
    },
    // 修改 地址列表中 被选中的 地址 id
    updateChoseId(state,id){
        state.address.choseId = id;
    },
    deleteAds(state,index){
        state.address.lists.splice(index,1);
    }
    
}